package com.simulate2.demo.dao;

import com.simulate2.demo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.math.BigDecimal;
import java.util.List;


//两个参数为所管控的实体，主键的类型
public interface UserRepository extends JpaRepository<User, Integer> {

    //这种自己书写sql语句的方法方便在navicat中进行测试，防止出现问题
    @Query(value = "SELECT * FROM user LIMIT 100000 OFFSET 9000000", nativeQuery = true)
    List<User> getAll();

    @Query(value = "SELECT SUM(active_credit) FROM user", nativeQuery = true)
    BigDecimal getSum();


}
